<?php
include '../classes/employeeHandler.php';
include '../classes/db.php';

$ini=addslashes($_GET['ini']);
$first=addslashes($_GET['first']);
$last=addslashes($_GET['last']);
$gen=$_GET['gender'];
$bdt1=$_GET['bdate'];

$month=substr($bdt1,3,2);
$year=substr($bdt1,6,4);
$day=substr($bdt1,0,2);
$b_dt=$year."-".$month."-".$day;//arrange date in format
$nic=$_GET['nic'];
$add=addslashes($_GET['address']);
$cont=$_GET['contact'];
$email=$_GET['email'];

$jdt1=$_GET['jdate'];
$jmonth=substr($jdt1,3,2);
$jyear=substr($jdt1,6,4);
$jday=substr($jdt1,0,2);
$j_dt=$jyear."-".$jmonth."-".$jday;//arrange date in format

$quali=addslashes($_GET['quali']);
$exe=addslashes($_GET['exe']);
$cat=$_GET['cat'];

$time_now=mktime(date('H')+5,date('i')+30,date('s'),date('m'),date('d'),date('Y'));
	 $yearnw=date('Y',$time_now); 
 	$monthnw=date('m',$time_now); 
 	$datenw=date('d',$time_now);

$x=new DbConnect();
$con=$x->getConnection();
$emp=new EmployeeHandler();
$emp->setCon($con);

	if (($jyear < $yearnw) || (($jyear == $yearnw)&&($jmonth < $monthnw)) || (($jyear == $yearnw)&&($jmonth = $monthnw)&&($jday <= $datenw)))
			{
			$result=$emp->employeeAdd($ini,$first,$last,$gen,$b_dt,$nic,$add,$cont,$email,$j_dt,$quali,$exe,$cat);
			echo $result;	
			}
	else 
			{
			echo "Future Date !";
			}

?>